netstormfandomcom-20200213-history
$OnExit
Exiting, stage left priestrun1.jpg This event appears to be pretty basic. So what does $OnExit do? Well, just like its name suggests, this will cause something to happen once a $Button event or a $Menu event has been called. The syntax for $OnExit is very much like the syntax for many of the other Netstorm events ($Button, $Menu): $OnExit=description,command,command extension The description is what the player will see inside a button. Note: description is optional. If you don't use it, you still have to have a comma before the command. You should know the Netstorm commands by heart by now: either MissionBegin, MissionFork, MissionAbort, MissionRestart, MissionReview, MissionEnd, Tell, GetTechnology or ShowTechnology. Command extension has to do with the command that you use. Refer to the advanced editing section to see what these commands need for their extensions. An example: Let's try an example. Say in your campaign you want the player to have a choice: either he allies with Mr Evil, or he fights against him. In either case, you want the storyline to branch to a section called continue. One way of doing this would be to use the $OnExit command as follows: Options A. Mr Evil, your sworn arch enemy for years, asks for an alliance. Do you agree? $Button=YES,DoNothing,0 $Button=No,DoNothing,0 $OnExit= ,Tell,continue continue Treachery! While you were deciding whether or not you wanted to ally with Mr. Evil, he has brazenly attacked your island! $Button=To Battle,DoNothing,0 So, no matter what is chosen, when a button is clicked on either YES or NO, the game will branch to the continue routine. Also, check out the $OnExit line. See the first comma? Make sure there's a space between the equals sign and the comma, or else the command won't work. Another example: Wait a second, swelb. Can I have a menu, and then after the player picks something from it, use the $OnExit command to continue with the story? Of course you can. Here's how you'd do it: Options A. Breaking into the enemy's encampment at night, you find plans for new weapons. You only have time to take one plan. Which will it be? $Menu=~IrainCannon.3rain cannon,GetTechnology,129 $Menu=~IsunCannon.3sun cannon,GetTechnology,128 $OnExit= ,Tell,gotweapon gotweapon A good choice! However, you've awakened the enemy! Prepare for battle! $Button=OK,DoNothing,0 There's one problem with using $OnExit. And that has to do with the above example. When you run the code and the player picks the weapon, the GetTechnology screen is shown, then immediately the program branches to gotweapon, and that screen is shown on top of the GetTechnology screen. Here's what you'll see before you select your Tech: So far so good, but what happens when you select what weapon you want? Well, in theory, you should get the standard Technology Gained screen, then another screen that tells you that what you selected was a good choice. Well, you do get those things, but.... see the problem? The Good Choice window draws over the Tech Gained window, which isn't really quite what we want. It would be nice to have the Good Choice window behind the other window. So, howdoyadothat, you say? I dunno. Haven't figured it out, yet. But we'll keep at it. category:NEC